package py.com.alfa.escriba.util;

import java.math.BigDecimal;


public class HelperMarker {
	
	private static final String[] UNIDADES = { "CERO", "UNO", "DOS", "TRES",
        "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE" };
	
	public String separarLetras(String data) {
		StringBuffer buf = new StringBuffer();
		if ( data == null || "".equals(data.trim())) {
			return null;
		}
		char[] var = data.trim().toCharArray();
		for (char c : var) {
			if ( c == ' ' ) {
				continue;
			}
			if ( buf.length() != 0) {
				buf.append(" - ");
			}
			if ( Character.isDigit(c)) {
			  buf.append(UNIDADES[Character.getNumericValue(c)]);
			} else {
				buf.append(c);
			}
		}
		
		return buf.toString();
	}
	
	public String numerosLetras(BigDecimal data) {				
		return NumberToLetterConverter.convertNumberToLetter(data.doubleValue(), null);
	}

	public String numerosLetras(Long data) {				
		return NumberToLetterConverter.convertNumberToLetter(data.doubleValue(), null);
	}	

	public String numerosLetras(Double data) {				
		return NumberToLetterConverter.convertNumberToLetter(data, null);
	}		
}
